{% set pypi_name = 'taskflow' %}
{% set upstream_version = upstream_version('4.5.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Taskflow structured state management library
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/taskflow
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PyMySQL') }}
BuildRequires:  {{ py3('SQLAlchemy') }}
BuildRequires:  {{ py3('SQLAlchemy-Utils') }}
BuildRequires:  {{ py3('alembic') }}
BuildRequires:  {{ py3('automaton') }}
BuildRequires:  {{ py3('cachetools') }}
BuildRequires:  {{ py3('eventlet') }}
BuildRequires:  {{ py3('fasteners') }}
BuildRequires:  {{ py3('futurist') }}
BuildRequires:  {{ py3('jsonschema') }}
BuildRequires:  {{ py3('kazoo') }}
BuildRequires:  {{ py3('kombu') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('networkx') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('psycopg2') }}
BuildRequires:  {{ py3('pydot') }}
BuildRequires:  {{ py3('redis') }}
BuildRequires:  {{ py3('retrying') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('tenacity') }}
BuildRequires:  {{ py3('testrepository') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildRequires:  {{ py3('zake') }}
BuildArch:      noarch

%description
A library to do [jobs, tasks, flows] in a HA manner using
different backends to be used with OpenStack projects.

%package -n python3-taskflow
Summary:        Taskflow structured state management library
Requires:       {{ py3('automaton') }}
Requires:       {{ py3('cachetools') }}
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('fasteners') }}
Requires:       {{ py3('futurist') }}
Requires:       {{ py3('jsonschema') }}
Requires:       {{ py3('kazoo') }}
Requires:       {{ py3('networkx') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Requires:       {{ py3('tenacity') }}

%description -n python3-taskflow
A library to do [jobs, tasks, flows] in a HA manner using
different backends to be used with OpenStack projects.

This package contains the Python 3.x module.

%package -n {{ py2name('taskflow') }}-doc
Summary:        Documentation for Taskflow
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n {{ py2name('taskflow') }}-doc
A library to do [jobs, tasks, flows] in a HA manner using
different backends to be used with OpenStack projects.
This package contains the associated documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

# generate html docs
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
python3 -m stestr.cli run

%files -n python3-taskflow
%doc README.rst
%license LICENSE
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/{{ pypi_name }}-*.egg-info

%files -n {{ py2name('taskflow') }}-doc
%license LICENSE
%doc doc/build/html

%changelog
